\hypertarget{classduye_1_1_tcp_client}{\section{duye\-:\-:Tcp\-Client Class Reference}
\label{classduye_1_1_tcp_client}\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}}
}


tcp client socket class  




{\ttfamily \#include $<$duye\-\_\-tcp\-\_\-client.\-h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
bool \hyperlink{classduye_1_1_tcp_client_ae268b0a428d5274c625a056cc8eac743}{connect} (const std\-::string \&server\-I\-P, const uint16 server\-Port, const uint32 timeout=0)
\begin{DoxyCompactList}\small\item\em connect to server \end{DoxyCompactList}\item 
\hypertarget{classduye_1_1_tcp_client_a9e9a44036c9775f6125fef8092a3872e}{bool {\bfseries disconnect} ()}\label{classduye_1_1_tcp_client_a9e9a44036c9775f6125fef8092a3872e}

\item 
int64 \hyperlink{classduye_1_1_tcp_client_abfdb5a09b48d3dd76b04f7b860eb989e}{recv} (\hyperlink{classduye_1_1_buffer}{Buffer} \&buffer, const bool is\-Block=false)
\begin{DoxyCompactList}\small\item\em receive data \end{DoxyCompactList}\item 
\hypertarget{classduye_1_1_tcp_client_a5f1c1034b4f5e2b8988b270e9c554c3d}{int64 {\bfseries recv} (int8 $\ast$buffer, const uint32 size, const bool is\-Block=false)}\label{classduye_1_1_tcp_client_a5f1c1034b4f5e2b8988b270e9c554c3d}

\item 
int64 \hyperlink{classduye_1_1_tcp_client_a0ace2762fbeec3be59d2cc5b5e38eeca}{send} (const \hyperlink{classduye_1_1_buffer}{Buffer} \&buffer)
\begin{DoxyCompactList}\small\item\em send data \end{DoxyCompactList}\item 
\hypertarget{classduye_1_1_tcp_client_a1ece0dcaf21e7fd41458fe40e000478e}{int64 {\bfseries send} (const int8 $\ast$data, const uint32 len)}\label{classduye_1_1_tcp_client_a1ece0dcaf21e7fd41458fe40e000478e}

\item 
const \hyperlink{classduye_1_1_i_pv4_addr}{I\-Pv4\-Addr} \& \hyperlink{classduye_1_1_tcp_client_af4480cd1839cd9d6779daceb65068209}{ipv4\-Addr} ()
\begin{DoxyCompactList}\small\item\em get server I\-Pv4 address \end{DoxyCompactList}\item 
const \hyperlink{classduye_1_1_socket}{Socket} \& \hyperlink{classduye_1_1_tcp_client_a9aedd2c03a63800a7c4d44410a14e972}{socket} ()
\begin{DoxyCompactList}\small\item\em get server socket \end{DoxyCompactList}\item 
\hypertarget{classduye_1_1_tcp_client_ac2bfcadfb329484a37f5187ee33c0238}{bool {\bfseries is\-Con} ()}\label{classduye_1_1_tcp_client_ac2bfcadfb329484a37f5187ee33c0238}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
tcp client socket class 

\subsection{Member Function Documentation}
\hypertarget{classduye_1_1_tcp_client_ae268b0a428d5274c625a056cc8eac743}{\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}!connect@{connect}}
\index{connect@{connect}!duye::TcpClient@{duye\-::\-Tcp\-Client}}
\subsubsection[{connect}]{\setlength{\rightskip}{0pt plus 5cm}bool duye\-::\-Tcp\-Client\-::connect (
\begin{DoxyParamCaption}
\item[{const std\-::string \&}]{server\-I\-P, }
\item[{const uint16}]{server\-Port, }
\item[{const uint32}]{timeout = {\ttfamily 0}}
\end{DoxyParamCaption}
)}}\label{classduye_1_1_tcp_client_ae268b0a428d5274c625a056cc8eac743}


connect to server 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em server\-I\-P} & \-: server ip address \\
\hline
\mbox{\tt out}  & {\em server\-Port} & \-: server port \\
\hline
\mbox{\tt in}  & {\em timeout} & \-: connect timeout, default is 0, indicate return immediately, millisecond \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true/false 
\end{DoxyReturn}
\hypertarget{classduye_1_1_tcp_client_af4480cd1839cd9d6779daceb65068209}{\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}!ipv4\-Addr@{ipv4\-Addr}}
\index{ipv4\-Addr@{ipv4\-Addr}!duye::TcpClient@{duye\-::\-Tcp\-Client}}
\subsubsection[{ipv4\-Addr}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf I\-Pv4\-Addr}\& duye\-::\-Tcp\-Client\-::ipv4\-Addr (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classduye_1_1_tcp_client_af4480cd1839cd9d6779daceb65068209}


get server I\-Pv4 address 

\begin{DoxyReturn}{Returns}
I\-Pv4 address 
\end{DoxyReturn}
\hypertarget{classduye_1_1_tcp_client_abfdb5a09b48d3dd76b04f7b860eb989e}{\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}!recv@{recv}}
\index{recv@{recv}!duye::TcpClient@{duye\-::\-Tcp\-Client}}
\subsubsection[{recv}]{\setlength{\rightskip}{0pt plus 5cm}int64 duye\-::\-Tcp\-Client\-::recv (
\begin{DoxyParamCaption}
\item[{{\bf Buffer} \&}]{buffer, }
\item[{const bool}]{is\-Block = {\ttfamily false}}
\end{DoxyParamCaption}
)}}\label{classduye_1_1_tcp_client_abfdb5a09b48d3dd76b04f7b860eb989e}


receive data 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt out}  & {\em buffer} & \-: output buffer \\
\hline
\mbox{\tt in}  & {\em buffer\-Size} & \-: buffer size \\
\hline
\mbox{\tt in}  & {\em is\-Block} & \-: block or unblock, default block \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size/-\/1 
\end{DoxyReturn}
\begin{DoxyNote}{Note}

\end{DoxyNote}
\hypertarget{classduye_1_1_tcp_client_a0ace2762fbeec3be59d2cc5b5e38eeca}{\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}!send@{send}}
\index{send@{send}!duye::TcpClient@{duye\-::\-Tcp\-Client}}
\subsubsection[{send}]{\setlength{\rightskip}{0pt plus 5cm}int64 duye\-::\-Tcp\-Client\-::send (
\begin{DoxyParamCaption}
\item[{const {\bf Buffer} \&}]{buffer}
\end{DoxyParamCaption}
)}}\label{classduye_1_1_tcp_client_a0ace2762fbeec3be59d2cc5b5e38eeca}


send data 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em data} & \-: send data \\
\hline
\mbox{\tt in}  & {\em len} & \-: data length \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size/-\/1 
\end{DoxyReturn}
\begin{DoxyNote}{Note}

\end{DoxyNote}
\hypertarget{classduye_1_1_tcp_client_a9aedd2c03a63800a7c4d44410a14e972}{\index{duye\-::\-Tcp\-Client@{duye\-::\-Tcp\-Client}!socket@{socket}}
\index{socket@{socket}!duye::TcpClient@{duye\-::\-Tcp\-Client}}
\subsubsection[{socket}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Socket}\& duye\-::\-Tcp\-Client\-::socket (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classduye_1_1_tcp_client_a9aedd2c03a63800a7c4d44410a14e972}


get server socket 

\begin{DoxyReturn}{Returns}
socket 
\end{DoxyReturn}


The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
Z\-:/duye/src/duyebase/net/\hyperlink{duye__tcp__client_8h}{duye\-\_\-tcp\-\_\-client.\-h}\end{DoxyCompactItemize}
